<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
  <link rel="apple-touch-startup-image" href="images/screen_320x460.png" />
  <link rel="apple-touch-icon" href="images/screen_57x57.png">
  <!-- Stylesheets -->
  <link rel="stylesheet" type="text/css" href="css/app.css" title="plain">
  <link rel="stylesheet" type="text/css" href="css/novnc-custom.css" title="plain">
</head>
<body>
  <div id="noVNC_screen">
    <div style="background: #f7f7f7; padding: 1.5em 1.5em 0.8em;">
      <div style="max-width: 1250px; margin: 0 auto;">
        <div id="noVNC_status_bar" class="noVNC_status_bar" style="display: flex; align-items: center;">
          <img src="images/opennebula-5.0.png" style="height:40px;">
          <h5 id="noVNC_status" style="position: relative;">
            <div class="container">
              <div class="remote_logo">
                <img src="images/remote_console/noVNC.png">
              </div>
              <div id="noVNC_status_msg">
                Loading
              </div>
            </div>
          </h5>
          <div id="noVNC_buttons">
          <button class="button alert" id="sendCtrlAltDelButton">Send CtrlAltDel</button>
            <span id="noVNC_xvp_buttons">
              <input type=button value="Shutdown" id="xvpShutdownButton">
              <input type=button value="Reboot" id="xvpRebootButton">
              <input type=button value="Reset" id="xvpResetButton">
            </span>
          </div>
        </div>
        <div class="NOVNC_info"></div>
      </div>
    </div>
    <div id="VNC_canvas" width="640px" height="20px">
      <div class="NOVNC_message"></div>
    </div>
  </div>

  <script src="dist/console/vnc.js?v=<%= OpenNebula::VERSION %>"></script>
  <% view = $views_config.view(session[:user], session[:user_gname], session[:default_view]) %>
  <script type="text/javascript">
      var csrftoken = '<%= session[:csrftoken] %>';
      var view = JSON.parse('<%= view.to_json %>')
      var available_views = JSON.parse('["<%=
          $views_config.available_views(session[:user], session[:user_gname]).join('","')
        %>"]')
      var all_labels = JSON.parse('["<%=
          $views_config.get_all_labels(session[:user_gname]).join('","')
        %>"]')
      var all_views = JSON.parse('["<%=
          $views_config.get_all_views.join('","')
        %>"]')
      if ('<%= $conf[:addons] %>'){
        var addons = JSON.parse('<%= $conf[:addons].to_json %>');
      }
      var config = {
        'user_config' : {
            'lang' : '<%= session[:lang] %>',
            'vnc_wss' : '<%= session[:vnc_wss] %>',
            'table_order' : '<%= session[:table_order] %>',
            'default_view' : '<%= session[:default_view] %>',
            'page_length' : '<%= session[:page_length] %>'
        },
        'system_config' : {
            'marketplace_url' : '<%= $conf[:marketplace_url] %>',
            'vnc_request_password' : <%= $conf[:vnc_request_password] || false %>,
            'vnc_proxy_port' : '<%= $vnc.proxy_port %>',
            'vnc_client_port' : '<%= $conf[:vnc_client_port] %>',
            'max_upload_file_size' : <%= $conf[:max_upload_file_size] ? $conf[:max_upload_file_size] : "undefined" %>
        },
        'view' : view,
        'available_views' : available_views,
        'all_labels' : all_labels,
        'all_views' : all_views,
        'user_id' : '<%= session[:user_id] %>',
        'user_gid' : '<%= session[:user_gid] %>',
        'display_name' : '<%= session[:display_name] %>',
        'zone_name' : '<%= session[:zone_name] %>',
        'zone_id' : '<%= session[:zone_id] %>',
        'federation_mode' : '<%= session[:federation_mode] %>',
        'vm_logos' : <%= logos_conf.to_json %>,
        'oned_conf' : <%= oned_conf.to_json %>,
        'support' : <%= support.to_json %>,
        'upgrade' : <%= upgrade.to_json %>,
        'mode' : '<%= session[:mode] %>'
      };
  </script>
</body>
</html>